<fieldset style="background: #FFF; margin-top: 20px; width: 260px;">
<form name="login" method="post" action="index.php?module=login">
<table width="252" border="0" cellspacing="0">
  <tr>
    <td width="90">Tài khoản</td>
    <td width="146">
        <select name="login_id" id="login_id">
            <option value="0">Quản lý bán hàng</option>
            <option value="1">Sản xuất</option> 
            <option value="2">Nhân sự</option>
                        <?php $loop = mysql_query("select * from thanhvien where phongban=9");
                                while ($row = mysql_fetch_array($loop))
                                    print "<option value=$row[thanhvienid]>$row[tenthanhvien]</option>";
                        ?>                       
        </select>    
    </td>
  </tr>
  <tr>
    <td>Mật khẩu</td>
    <td><input type="password" name="login_pw" value="1"/></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><label>
      <input type="submit" class="button" name="submit" id="button" value="Đăng nhập" />
    </label></td>
  </tr> 
</table>
</form>
<?php

//print_r ($_POST);

if (isset($_POST['submit']))
{
    $name = $_POST['login_id']; //echo $name;
    $pass = md5($_POST['login_pw']); //echo $pass;
    if ($pass == md5 ('1'))
        {
            $_SESSION ['thanhvien'] = $name;
                                            
            switch ($name)
            {
                case 0 : echo "<script>window.location='index.php?quanlybanhang&module=quanlydonhang&thanhvien=0&tinhchat=0&thang=0'</script>";break;
                case 1 : echo "<script>window.location='index.php?quanlysanxuat&module'</script>";break;
                case 2 : echo "<script>window.location='index.php?nhansu&module'</script>";break;
                default : echo "<script>window.location='index.php?banhang&module'</script>";
            }

        }
}

//print $_SESSION['thanhvien'];

?> 

</fieldset>


